<?php

{{ builderInfo.php|raw }}

namespace {{ thisWidget.namespace }};

class {{ thisWidget.class }} extends \ADIOS\Core\Widget {
  public function onBeforeDesktopParams(\ADIOS\Controllers\Desktop $desktop) {
{% for itemTitle, itemConfig in thisWidget.config.sidebar %}
    $desktop->addSidebarItem($this, [
      {% if itemConfig.icon %} "icon" => "{{ itemConfig.icon }}", {% endif %}
      "title" => "{{ itemTitle }}",
{% if itemConfig.url %}
      "onclick" => "ADIOS.renderDesktop('{{ itemConfig.url }}');",
{% endif %}
{% if itemConfig.sub is iterable %}
      "sub" => [
{% for subItemTitle, subItemConfig in itemConfig.sub %}
        [
          "title" => "{{ subItemTitle }}",
          "onclick" => "ADIOS.renderDesktop('{{ subItemConfig.url }}');",
        ],
{% endfor %}
      ],
{% endif %}
    ]);
{% endfor %}
  }
}
